function [Waste] = HPZ_Grid_Search_MME (prob_x,beta,rho,A,flag,max_x1,max_x2,utility,treatment)

% Lion in the desert

num_of_iterations = 15;

Waste_UPPER = 1;

Waste_LOWER = 0;

Waste = 1/2;

param = zeros (1,2);

param(1,1) = beta;

if flag==1
    
    param(1,2) = rho;
    
else
    
    param(1,2) = A;
    
end
    
for i=1:num_of_iterations
    
    temp_price = zeros(1,2);
    
    temp_price(1,1) = 1/(Waste*max_x1);
    
    temp_price(1,2) = 1/(Waste*max_x2);

    x = HPZ_Choices (temp_price,1,treatment,flag,1,param);

    u = HPZ_Utility(prob_x,x,beta,rho,A,flag);

    if utility-u>0
        Waste_LOWER = Waste;
    else
        Waste_UPPER = Waste;
    end 

    Waste = (1/2)*(Waste_LOWER + Waste_UPPER);        
end

end